package com.bsoft.gol.hcb.dao.evaluation;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import ctd.spring.boot.annotation.SsdevDao;
import ctd.util.annotation.RpcService;
import hcn.base.evaluation.EvaluationItemRecord;
import java.util.List;

/**
 * Created by mlm on 2015/11/30.
 *
 * 满意度评价项目记录
 */
@SsdevDao(serviceId = "evaluationItemRecordDAOService")
public abstract class EvaluationItemRecordDAO extends HibernateSupportDelegateDAO<EvaluationItemRecord> {

    public EvaluationItemRecordDAO() {
        this.setKeyField("id");
    }


    /**
     * 查看详情
     * @param recordId
     * @return
     */
    @RpcService
    @DAOMethod(sql = "select item.content,st.level,item.id,edf.occasion " +
            "from EvaluationItemRecord st,EvaluationItem item ,EvaluationDefine edf " +
            "where st.recordId=:recordId and st.itemId=item.id and item.defineId=edf.id " +
            "order by item.orderNum ")
    public abstract List<Object[]> findDetailByRecordId(@DAOParam("recordId") int recordId);


    /**
     * 查询项目记录
     * @param recordIds
     * @return
     */
    @RpcService
    @DAOMethod(sql = "select item from EvaluationItem item,EvaluationDefine def where def.businessType=:businessType and def.id=item.defineId "
    		+ " and item.tenantId=:tenantId"
    		,params = {@DAOParam(name = "tenantId", value = "%$ur.tenantId", dataType = "string")})
    public abstract List<Object[]> findListByRecordIds(@DAOParam("recordIds") Integer[] recordIds);


}
